import Vue from "vue";
import App from "./App.vue";
import router from "@/router";
import ElementUI from "element-ui";
import "element-ui/lib/theme-chalk/index.css";
import "@/styles/reset.less";
import "lib-flexible/flexible.js";
Vue.use(ElementUI);

import AMap from "vue-amap";
Vue.use(AMap);

//自定义指令
Vue.directive("fixImg", {
  inserted: (el, option) => {
    el.addEventListener("error", () => {
      el.src = option.value;
    });
    el.src = el.src || option.value;
  },
  componentUpdated(el, option) {
    el.src = el.src || option.value;
  },
});
// 初始化vue-amap
AMap.initAMapApiLoader({
  // 高德key
  key: "e3ad02ff2c2579a5fd699e74d114852b",
  // 插件集合 （插件按需引入）
  plugin: ["AMap.Geolocation"],
});

Vue.config.productionTip = false;

new Vue({
  render: (h) => h(App),
  router,
}).$mount("#app");
